﻿@using TjZheng.Power.DataEntity;
@inherits CMSWebViewPage<UserInfo>
@{
    ViewBag.Title = "用户编辑";
    Layout = "~/Views/Shared/_EditLayout.cshtml";
}
@section Head{
    @*@Html.CreateUpLoadSource()*@
    @*@Html.CreateEditorSource()*@
}
<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'center',border:false" class="xhidden">
        <div class="top-block">
            @CurrentButtonTool.Create()
        </div>
        <form id="fr_userinfo" method="post" enctype="multipart/form-data">
            @*@Html.AntiForgeryToken()*@
            <table class="tblContent">
                <colgroup>
                    <col class="colTitle" />
                    <col class="colContent" />
                    <col class="colTitle" />
                    <col class="colContent" />
                </colgroup>
                <tr>
                    <td><span class="txtNoNull">*</span>用户名称:</td>
                    <td>
                        @Html.Hidden("objProvide.Id", Model.Id, false)
                        @Html.StringBox("objProvide.UserName", Model.UserName, true, "请输入用户名称", null, ValidType.Length(64))
                    </td>
                    <td><span class="txtNoNull">*</span>用户密码:</td>
                    <td>
                        @Html.StringBox("objProvide.Password", Model.Password, true, "请输入用户密码", new { type = "password" }, null, ValidType.Length(64))
                    </td>
                </tr>
                <tr>
                    <td><span class="txtNoNull">*</span>真实姓名:</td>
                    <td>
                        @Html.StringBox("objProvide.RealName", Model.RealName, true, "请输入真实姓名", null, ValidType.Length(64))
                    </td>
                    <td><span class="txtNoNull">*</span>权限类型:</td>
                    <td>
                        @Html.RadioButtonList("objProvide.PowerType", Model.PowerType, true, new List<SelectListItem>
                       {
                           new SelectListItem{Text="继承角色组部分权限",Value="0"},
                           new SelectListItem{Text="继承角色组所有权限",Value="1"},
                           new SelectListItem{Text="用户独立权限",Value="2"},
                       })
                    </td>
                </tr>
                <tr>
                    <td>性别:</td>
                    <td>
                        @Html.RadioButtonList("objProvide.Sex", Model.Sex, false, new List<SelectListItem>
                       {
                           new SelectListItem{Text="男",Value="0"},
                           new SelectListItem{Text="女",Value="1"}
                       })
                    </td>
                    <td>头像:</td>
                    <td>
                        @Html.UpLoadNativeImage(1, "objProvide.Avatar", Model.Avatar)
                        @Html.CheckClearValue("清除配图", "objProvide.Avatar")
                    </td>
                </tr>
                <tr>
                    <td>手机号:</td>
                    <td>
                        @Html.StringBox("objProvide.Telephone", Model.Telephone, false, "请输入手机号", null, ValidType.Length(64))
                    </td>
                    <td>QQ号:</td>
                    <td>
                        @Html.StringBox("objProvide.QQ", Model.QQ, false, "请输入QQ号", null, ValidType.Length(64))
                    </td>
                </tr>
                <tr>
                    <td>邮箱:</td>
                    <td>
                        @Html.StringBox("objProvide.Email", Model.Email, false, "请输入邮箱", null, ValidType.Length(64), ValidType.Regex(ValidExpression.Email))
                    </td>
                    <td>所属部门:</td>
                    <td>
                        @Html.StringBox("objProvide.Department", Model.Department, false, "请输入所属部门", null, ValidType.Length(64))
                    </td>
                </tr>
                <tr>
                    <td>地址:</td>
                    <td colspan="3">
                        @Html.StringBox("objProvide.Address", Model.Address, false, "请输入地址", new { style = "width:619px" }, null, ValidType.Length(128))
                    </td>
                </tr>
                <tr>
                    <td>自我简述:</td>
                    <td colspan="3">
                        @Html.TextArea("objProvide.Description", Model.Description, 5, 100, false, "请输入自我简述")
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <div class="image-preview" title="图片预览" data-options="region:'east',border:true">
        <div>
            <h1>头像</h1>
            @Html.ImagePreview("objProvide.Avatar", Model.Avatar)
        </div>
    </div>
</div>
@section Bottom{
    <script type="text/javascript">
        function Save() {
            var objFormEntity = new FormEntity("#fr_userinfo");
            objFormEntity.url = "/userinfo/save";
            objFormEntity.submitSuccess = function (InvokeResult) {
                if (InvokeResult.ResultCode == "Success") {
                    ShowMessage(InvokeResult.ResultMessage);
                    Back();
                } else {
                    ShowMessage(InvokeResult.ResultMessage);
                }
            };
            objFormEntity.isClearData = false;
            objFormEntity.submit();
        }
        function Back() {
            window.location.href = "/userinfo";
        }
    </script>
}

